import { getGameObjectById } from "../engine";
import { Behaviour } from "../engine/Behaviour";
import { TextRenderer } from "../engine/TextRenderer";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";
import { Display } from "./Display";
import { Order } from "./Order";
import { Tip } from "./Tip";

export class OrderButtonClick extends Behaviour {

    getit_clickFlag=0;
      what_clickFlag=0;

    onStart() {
        //this.startSati = false
        

        this.gameObject.onClick = () => {
             console.log(this.gameObject.id);
            if(this.gameObject.id=="UI_dialog_button_getIt"){ 
                this.getit_clickFlag=1;        
                //getGameObjectById('UI_dialog_frame').getBehaviour(Display).IsActive=false;
               // getGameObjectById('UI_dialog_requirement').getBehaviour(Display).IsActive=false;
                //getGameObjectById('UI_dialog_button_getIt').getBehaviour(Display).IsActive=false;
               // getGameObjectById('UI_dialog_button_what').getBehaviour(Display).IsActive=false;
               // getGameObjectById('UI_dialog_requirement_detail').getBehaviour(Display).IsActive=false;
                
                //懂了后满意度重置并开始减少
                console.log("懂了，然后：")
                getGameObjectById('UI_satisfaction_text').getBehaviour(Tip).reset = true
                getGameObjectById('UI_satisfaction_text').getBehaviour(Tip).startSati = true
                //console.log(getGameObjectById('UI_satisfaction_text').getBehaviour(Tip).startSati)

                this.engine.scenenumber = 2
            }

            if(this.gameObject.id=='UI_dialog_button_what'){
                this.what_clickFlag=1;
                //getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text="就是一份烤冷面加鸡蛋加洋葱呀。";
                getGameObjectById('UI_dialog_requirement').getBehaviour(Display).IsActive=false;
                getGameObjectById('UI_dialog_requirement_detail').getBehaviour(Display).IsActive=true;

                switch(getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text){
                    case "来一份经典原味的烤冷面！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="就是面皮儿加鸡蛋呀！";
                        break;
                    }
                    case "老板，我要一个经典加肠烤冷面。":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="原味的烤冷面加上一根烤肠！";
                        break;
                    }
                    case "来份火辣辣烤冷面！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="加辣条！加辣条！加辣条！";
                        break;
                    }
                    case "我要一个加鸡柳烤冷面。":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="给我多加鸡柳！";
                        break;
                    }
                    case "我要一个烤冷面加培根。":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="只加培根！别加错了！";
                        break;
                    }
                    case "原味的加蒜蓉酱！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="不要原味酱！要蒜蓉酱！";
                        break;
                    }
                    case "没人不喜欢葱花吧！你说是不是！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="多给我加两份葱花！";
                        break;
                    }
                    case "原味的！我爱BJUT！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="用工大限定包装盒哦！";
                        break;
                    }
                    case "老板，最近想尝尝辣酱了~":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="听说辣酱比原味酱好吃啊~";
                        break;
                    }
                    case "老板，来一个豪华套餐！":{
                        getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text="所有的配料都来一份！";
                        break;
                    }
                    default:{
                        break;
                    }

                }

            }
        };
    }

    onTick(duringTime: number) {

    }
}
